I have a dxl script that runs and exports some things into xml. At runtime, I would like to validate the xml to make sure that it is correct. To do this I was using the undocumented APi parseXMLBuffer_(Buffer) |
Re: Validating XML in dxl Not familiar with XML or any of this. But if you want to see if some DXL works you can package it up and send it to "eval_" and check for errors. Someone will surely correct this post and also tell us how to send a Buffer to eval_ (send its address), but the code would look something like this.
bool isXMLValid(Buffer bufOutput)
{
string XML = tempStringOf(bufOutput)
string DXL ="DOM_Document_ temp = parseXMLBuffer_ (\"" XML "\")
return_(\"OK\")
" // end definition of string DXL
string Results = eval_(DXL)
return(Results == "OK")
}
|
Re: Validating XML in dxl llandale - Mon Aug 15 17:54:59 EDT 2011 Not familiar with XML or any of this. But if you want to see if some DXL works you can package it up and send it to "eval_" and check for errors. Someone will surely correct this post and also tell us how to send a Buffer to eval_ (send its address), but the code would look something like this.
bool isXMLValid(Buffer bufOutput)
{
string XML = tempStringOf(bufOutput)
string DXL ="DOM_Document_ temp = parseXMLBuffer_ (\"" XML "\")
return_(\"OK\")
" // end definition of string DXL
string Results = eval_(DXL)
return(Results == "OK")
}
-Adam |
Re: Validating XML in dxl SystemAdmin - Mon Aug 15 18:08:34 EDT 2011 My trigger deploy code uses checkDXL and won't deploy unless it at least interprets.
|
Re: Validating XML in dxl llandale - Mon Aug 15 18:51:54 EDT 2011
|
Re: Validating XML in dxl gandr - Tue Aug 16 11:29:29 EDT 2011 e.g. turn: abc\d"0o\"dd into abc\\d\"0o\\\"dd Too lazy to search previous threads for that. Not sure this is such a good solution for you any more.
|
Re: Validating XML in dxl gandr - Tue Aug 16 11:29:29 EDT 2011 The easy workaround is: Don't embed the XML directly, just write it to a file and read the file from the eval context, or pass the buffer directly to the eval context:
bool isXMLValid(Buffer bufOutput)
{
// pass Buffer directly in eval context
string DXL = "
Buffer result = addr_ " ((addr_ bufOutput) int) "
DOM_Document_ temp = parseXMLBuffer_ result
return_(null temp ? \"NULL\" : \"OK\")
" // end definition of string DXL
string Results = eval_(DXL);
return(Results == "OK")
}
Buffer x = create();
x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT/>"
print "VALID:" (isXMLValid x) "\n"
x = "Hallo"
print "VALID:" (isXMLValid x) "\n"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Validating XML in dxl Mathias Mamsch - Thu Aug 18 05:30:03 EDT 2011 The easy workaround is: Don't embed the XML directly, just write it to a file and read the file from the eval context, or pass the buffer directly to the eval context:
bool isXMLValid(Buffer bufOutput)
{
// pass Buffer directly in eval context
string DXL = "
Buffer result = addr_ " ((addr_ bufOutput) int) "
DOM_Document_ temp = parseXMLBuffer_ result
return_(null temp ? \"NULL\" : \"OK\")
" // end definition of string DXL
string Results = eval_(DXL);
return(Results == "OK")
}
Buffer x = create();
x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT/>"
print "VALID:" (isXMLValid x) "\n"
x = "Hallo"
print "VALID:" (isXMLValid x) "\n"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
For completeness, Here is the error that I am getting: DXL: <Line:3> An unexpected error has occurred: doors.exe caused an EXCEPTION_ACCESS_VIOLATION in module xml4c-depdom_5_7.dll at 001B:1201CCF8, xml4c_5_7::RefCountedImpl::removeRef()+0008 byte(s) -R-F- DXL: <Line:3> internal error, please submit a bug report -R-E- DXL: <Line:3> An unexpected error has occurred: Unspecified Failure |
Re: Validating XML in dxl gandr2 - Thu Aug 18 09:34:24 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |